package com.heima.controller;


import com.heima.service.ITbOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author AkiRinko
 * @since 2024-06-11
 */
@RestController
@RequestMapping("/api/order-service")
@RequiredArgsConstructor
public class TbOrderController {
    private final ITbOrderService tbOrderService;

    /**
     * 订单总量
     * @param start
     * @param end
     * @return
     */
    @GetMapping("/report/orderCount")
    private String selectOrderCount(@RequestParam(value = "start", required = false) String start,
                                     @RequestParam(value = "end", required = false) String end) {
        return tbOrderService.selectOrderCount(start, end);
    }

    /**
     * 当月销售额
     * @param start
     * @param end
     * @return
     */
    @GetMapping("/report/orderAmount")
    private Integer selectOrderAmount(@RequestParam(value = "start", required = false) String start,
                                     @RequestParam(value = "end", required = false) String end){
        return tbOrderService.selectOrderAmount(start, end);
    }
}
